<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see ProController
 */
class ProController extends BaseController
{

    /**
     * getList
     * @uri /pro/list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"category_id":"D3EAC374EC4F820B"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":10,"page":1,"page_size":5,"list":[{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","description":"\u674e\u5929\u5176\u7b80\u4ecb","qrcode":"","created_at":1606616678,"phone":"15715867560","category":[{"id":1,"name":"\u5fc3\u7406","member_count":1,"weight":9,"status":1,"is_deleted":0,"created_at":1604374196},{"id":2,"name":"\u804c\u4e1a\u53d1\u5c55","member_count":1,"weight":8,"status":1,"is_deleted":0,"created_at":1604374196}]}]},"message":"OK"}
     */
    public function getList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":10,"page":1,"page_size":5,"list":[{"id":"00K5H1KO60NAEIXXDT1SPMMM","nickname":"\u7c89\u5237\u5320","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","description":"\u674e\u5929\u5176\u7b80\u4ecb","qrcode":"","created_at":1606616678,"phone":"15715867560","category":[{"id":1,"name":"\u5fc3\u7406","member_count":1,"weight":9,"status":1,"is_deleted":0,"created_at":1604374196},{"id":2,"name":"\u804c\u4e1a\u53d1\u5c55","member_count":1,"weight":8,"status":1,"is_deleted":0,"created_at":1604374196}]}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * recommendList
     * @uri /pro/recommend-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"page":"5824534AE449D5E4"}
     * @response {"success":true,"statusCode":200,"result":{"total_count":1,"page_size":20,"page":1,"list":[{"id":"24\u4f4d\u667a\u56ca\u56e2ID","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","nickname":"\u667a\u56ca\u56e2\u6635\u79f0","description":"\u667a\u56ca\u56e2\u7b80\u4ecb","qrcode":"\u5fae\u4fe1\u4e8c\u7ef4\u7801\u56fe\u7247","category":{"id":1,"name":"\u667a\u56ca\u56e2\u5206\u7c7b\u540d\u79f0"}}]},"message":"OK"}
     */
    public function recommendList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"total_count":1,"page_size":20,"page":1,"list":[{"id":"24\u4f4d\u667a\u56ca\u56e2ID","avatar":"2e40f4e2d75d6db4e2deba6dc58f1105.png","nickname":"\u667a\u56ca\u56e2\u6635\u79f0","description":"\u667a\u56ca\u56e2\u7b80\u4ecb","qrcode":"\u5fae\u4fe1\u4e8c\u7ef4\u7801\u56fe\u7247","category":{"id":1,"name":"\u667a\u56ca\u56e2\u5206\u7c7b\u540d\u79f0"}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}